﻿Chenxin.UI.allotcustomerManage = Chenxin.extend(Chenxin.UI.PageCommon, {
    autoInitForm: false,
    actionUrl: 'service/customDistributList.ashx',
    createGrid: function() {
        /* return new Chenxin.UI.Pagination({
            actionUrl: this.actionUrl + '?op=getlist',
            domId: 'page',
			renderTo:'allotcustomermanager_table',
            pageSize: 10
        }); */
		
		return new Chenxin.UI.JsonGrid({
            actionUrl: this.actionUrl + '?op=getlist',
			renderTo:'allotcustomermanager_table',
			height:300,
			modelId:'RecordID',
			hasCheckBox:false,
			title:'客需分配列表',
			columns:{
				CustomerName:{
					head:'客户姓名',
					width:80,
					sortable:true
				},
				OldPerson:{
					head:'原所属人',
					width:100,
					sortable:true
				},
				OldDepart:{
					head:'原门店',
					width:80,
					sortable:true
				},
				OldCompany:{
					head:'原公司',
					width:80,
					sortable:true
				},
				OldCity:{
					head:'原城市',
					width:80,
					sortable:true
				},
				NowPerson:{
					head:'现所属人',
					width:100,
					sortable:true
				},
				NowDepart:{
					head:'现门店',
					width:80,
					sortable:true
				},
				NowCompany:{
					head:'现公司',
					width:80,
					sortable:true
				},
				NowCity:{
					head:'现城市',
					width:80,
					sortable:true
				},
				OperPerson:{
					head:'操作人',
					width:80,
					sortable:true
				},
				OperTime:{
					head:'操作时间',
					width:120,
					sortable:true
				}
			}
		});
    },
	createForm:function(){
		return new Chenxin.UI.AllothouseForm({
			scope:this,
			actionUrl:this.actionUrl,
			getListOp:'getcustomerlist',
			getAlltCustomerOp:'getallotusers_customer',
			listAltMsg:'请选择客源！'
		});
	},
    initEvent: function() {
        var _this = this;
		$('#allot_customer').click(function(){
			_this.add();
			_this.form.reset();
			_this.form.setTitle('分配客需');
        });
        $('#keyword').defText({
            deftxt: '输入客户名称/编号'
        });
    },

    createSearch: function() {
        return new Chenxin.UI.allotcustomerManageSearch({
            scope: this
        });
    },
    initComponent: function() {
        Chenxin.UI.allotcustomerManage.superclass.initComponent.call(this);
    }
});


/**
*查询面板
*/
Chenxin.UI.allotcustomerManageSearch = Chenxin.extend(Chenxin.UI.SearchCommon, {
    id: 'allothousemanager_search',
    initEvent: function() {
        var _this = this;
        $('#btn_search').click(function() {
            _this.scope.reloadGrid();
        });
    },
    createComboList: function() {
        var combl = new Chenxin.UI.StructComboList();
        var structs = combl.comboList;
        return structs;
    },
    initComponent: function() {
        Chenxin.UI.allotcustomerManageSearch.superclass.initComponent.call(this);
    }
});

$(document).ready(function() {
    var allotcustomerMgr = new Chenxin.UI.allotcustomerManage();
});